package com.concerneyes.mine.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.concerneyes.R;
import com.concerneyes.mine.model.MyAdressModel;

import java.util.HashMap;
import java.util.Map;

import common.BASE_Adapter;

public class MyAdressAdapter extends BASE_Adapter<MyAdressModel> {
    // 用于记录每个RadioButton的状态，并保证只可选一个
    public MyAdressAdapter(Context context) {
        super(context);
    }

    @Override
    public View createView(LayoutInflater inflater, final int position, View convertView, ViewGroup parent) {
        final Holder holder;
        if (convertView == null) {
            holder = new Holder();
            convertView = inflater.inflate(R.layout.adapter_my_adress, null);
            holder.tv_name = (TextView) convertView.findViewById(R.id.tv_name);
            holder.tv_phone = (TextView) convertView.findViewById(R.id.tv_phone);
            holder.tv_adress = (TextView) convertView.findViewById(R.id.tv_adress);
            convertView.setTag(holder);
        } else {
            holder = (Holder) convertView.getTag();
        }
		MyAdressModel model = getItem(position);
		holder.tv_name.setText(model.getName());
		holder.tv_phone.setText(model.getPhone1());
		holder.tv_adress.setText(model.getAddress());
        return convertView;
    }

    class Holder {
        TextView tv_name;
        TextView tv_phone;
        TextView tv_adress;
    }
}
